Define getrowval and getnzval for sparse vectors - #805
Conversation
`rowvals` already covers `SparseVectorUnion`, but the `getrowval` and `getnzval` accessors used throughout linalg.jl only had matrix methods. Add the vector methods so both accessor families cover both types. Fixes #172 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbrk9jqFT4HCx4ENQdtx6f
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #805 +/- ##
=======================================
Coverage 92.55% 92.55%
=======================================
Files 12 12
Lines 8728 8734 +6
=======================================
+ Hits 8078 8084 +6
Misses 650 650 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add docstrings and docs entries for `getrowval` and `getnzval`, mark them `public`, and forward them through triangular wrappers like `rowvals` and `nonzeros` already are. Note in the `rowvals` and `nonzeros` docstrings that the new names match the `SparseMatrixCSC` fields and that the old names are likely to be deprecated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbrk9jqFT4HCx4ENQdtx6f
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbrk9jqFT4HCx4ENQdtx6f
|
@ViralBShah I just fixed a conflict with the same implementation of rowvals but I realize that it would be preferable to homogenize all methods to use a |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@matbesancon agreed, done in 947cb73: the new vector methods and the triangular forwards now dispatch on Written by Claude Code. |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fixes #172.
rowvals(x::SparseVectorUnion)already existed, butgetrowvalandgetnzval(the accessors used throughoutlinalg.jl) only hadAbstractSparseMatrixCSCmethods. This adds theSparseVectorUnionmethods, forwarding tononzeroindsandnonzeros, so both accessor families cover both matrices and vectors (including column views and whole-vector views).It also documents and exports
getrowvalandgetnzval, whose names match therowvalandnzvalfields ofSparseMatrixCSC:rowvalsandnonzerosdo.rowvalsandnonzeros, including thenzrangeexample, are left as they are, and no deprecation ofrowvalsornonzerosis announced here.Tests added to the existing
basic propertiestestset intest/sparsevector.jl. Doctests and the Documenter build pass locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lbrk9jqFT4HCx4ENQdtx6f